const account = (() => {


    axios.defaults.baseURL = 'http://60.204.218.206:8088';
    const login = () => {

    $("form").on("submit", function() {       
    let data=new URLSearchParams()
    data.append("name",$('[name=name]').val())
    data.append("pwd",$('[name=pwd]').val())

    axios({        
        url:"/account/login",
        method:"post",
        data:data
    }).then(function(res){
        if(res.data.code==200){
            layer.msg(res.data.msg)
            localStorage.setItem("token",res.data.token)
            localStorage.setItem("user",JSON.stringify(res.data.data))

        }
        // console.log(res);
    })

        return false;
    })


    }

    return {
        login
        // ...
    }

})()


$(function () {
    account.login()
})